package springframework.common;

import com.qumoyugo.springframework.beans.BeansException;
import com.qumoyugo.springframework.beans.PropertyValue;
import com.qumoyugo.springframework.beans.PropertyValues;
import com.qumoyugo.springframework.beans.factory.ConfigurableListableBeanFactory;
import com.qumoyugo.springframework.beans.factory.config.BeanDefinition;
import com.qumoyugo.springframework.beans.factory.config.BeanFactoryPostProcessor;

/**
 * @author Cedric
 * @date 2021/11/24 17:08
 * @description BeanFactoryPostProcessor实现
 */
public class MyBeanFactoryPostProcessor implements BeanFactoryPostProcessor {
    @Override
    public void beanPostProcessor(ConfigurableListableBeanFactory beanFactory) throws BeansException {
        BeanDefinition beanDefinition = beanFactory.getBeanDefinition("userService");
        PropertyValues propertyValues = beanDefinition.getPropertyValues();
        propertyValues.addPropertyValue(new PropertyValue("company", "稀饭旅行"));
    }
}
